import instance from "@/request/request";
import type { Res } from '@/request/ResultApi';

//获取所有检测记录
export const getAllInspectorCords = (size: number, current: number, lineId: number, orderItemId: number, timeOrderBy: number): Res<null> => {
    let str = ""
    if (!Number.isNaN(lineId) && lineId >= 0) str += '&lineId=' + lineId
    if (!Number.isNaN(orderItemId) && orderItemId >= 0) str += '&orderItemId=' + orderItemId
    return instance.get(`/inspectorCords/all?size=${size}&current=${current}&&timeOrderBy=${timeOrderBy}${str}`);
}
//添加检测记录
export const addInspectorCords = (data: {
    lineId: number,
    defectFile: String,
}): Res<null> => instance.post("/inspectorCords/add", data);

//删除检测记录
export const removeInspectorCords = (inspectorCordsId: number): Res<null> =>
    instance.post(`/inspectorCords/delete?inspectorCordsId=${inspectorCordsId}`);

//批量删除检测记录
export const removeInspectorCordss = (data: []): Res<null> => instance.post("/inspectorCords/deletes", data);